<?php

/**
 * This is the model class for table "{{profiles}}".
 *
 * The followings are the available columns in table '{{profiles}}':
 * @property integer $user_id
 * @property string $nickname
 * @property string $idcard
 * @property integer $sex
 * @property integer $birthday
 * @property string $place
 * @property string $nation
 * @property integer $marry
 * @property string $address
 * @property string $contact
 * @property string $post
 * @property string $phone
 * @property string $im
 * @property integer $politics
 * @property string $jobtitle
 * @property string $job
 * @property string $blog
 * @property string $pphoto
 * @property integer $highest_education
 * @property string $graduation_date
 * @property string $school
 * @property string $department
 * @property string $specialities
 * @property string $research_directions
 * @property string $work_experience
 * @property string $scientific_result
 * @property string $achievement
 * @property string $social_position
 * @property string $n_second_school_major
 * @property string $n_computer_skill
 * @property string $n_computer_achievement
 * @property string $n_skill_mark
 * @property string $n_work
 * @property integer $n_activity
 * @property string $s_admission_date
 * @property string $s_studentid
 * @property string $s_school_position
 * @property string $c_legal_person
 * @property string $c_hr_manager
 * @property string $c_contacter_tel
 * @property string $c_introduce_photo
 * @property string $c_id_photo
 * @property string $c_introduce
 * @property string $c_board_members
 * @property integer $type_pg
 * @property integer $type_p_vasn
 * @property integer $type_g_pebg
 * @property integer $open
 * @property string $c_email
 */
class Profiles extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Profiles the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{profiles}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
//			array('user_id, research_directions, work_experience, scientific_result, achievement, n_computer_skill, n_computer_achievement, n_work, c_introduce', 'required'),
			array('user_id, sex, birthday, marry, politics, highest_education, type_pg, type_p_vasn, type_g_pebg, open', 'numerical', 'integerOnly'=>true),
//			array('nickname, address, contact, blog, pphoto, n_second_school_major, n_skill_mark, c_introduce_photo, c_id_photo, n_activity, c_board_members', 'length', 'max'=>255),
//			array('idcard, place, phone, jobtitle, job, s_studentid, c_legal_person, c_hr_manager', 'length', 'max'=>32),
//			array('nation, school, department, specialities, social_position, s_school_position, c_contacter_tel, c_email', 'length', 'max'=>64),
//			array('post, graduation_date, s_admission_date', 'length', 'max'=>8),
//			array('im', 'length', 'max'=>12),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('user_id, nickname, idcard, sex, birthday, place, nation, marry, address, contact, post, phone, im, politics, jobtitle, job, blog, pphoto, highest_education, graduation_date, school, department, specialities, research_directions, work_experience, scientific_result, achievement, social_position, n_second_school_major, n_computer_skill, n_computer_achievement, n_skill_mark, n_work, n_activity, s_admission_date, s_studentid, s_school_position, c_legal_person, c_hr_manager, c_contacter_tel, c_introduce_photo, c_id_photo, c_introduce, c_board_members, type_pg, type_p_vasn, type_g_pebg, open, c_email', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'user_id' => 'User',
			'nickname' => 'Nickname',
			'idcard' => 'Idcard',
			'sex' => 'Sex',
			'birthday' => 'Birthday',
			'place' => 'Place',
			'nation' => 'Nation',
			'marry' => 'Marry',
			'address' => 'Address',
			'contact' => 'Contact',
			'post' => 'Post',
			'phone' => 'Phone',
			'im' => 'Im',
			'politics' => 'Politics',
			'jobtitle' => 'Jobtitle',
			'job' => 'Job',
			'blog' => 'Blog',
			'pphoto' => 'Pphoto',
			'highest_education' => 'Highest Education',
			'graduation_date' => 'Graduation Date',
			'school' => 'School',
			'department' => 'Department',
			'specialities' => 'Specialities',
			'research_directions' => 'Research Directions',
			'work_experience' => 'Work Experience',
			'scientific_result' => 'Scientific Result',
			'achievement' => 'Achievement',
			'social_position' => 'Social Position',
			'n_second_school_major' => 'N Second School Major',
			'n_computer_skill' => 'N Computer Skill',
			'n_computer_achievement' => 'N Computer Achievement',
			'n_skill_mark' => 'N Skill Mark',
			'n_work' => 'N Work',
			'n_activity' => 'N Activity',
			's_admission_date' => 'S Admission Date',
			's_studentid' => 'S Studentid',
			's_school_position' => 'S School Position',
			'c_legal_person' => 'C Legal Person',
			'c_hr_manager' => 'C Hr Manager',
			'c_contacter_tel' => 'C Contacter Tel',
			'c_introduce_photo' => 'C Introduce Photo',
			'c_id_photo' => 'C Id Photo',
			'c_introduce' => 'C Introduce',
			'c_board_members' => 'C Board Members',
			'type_pg' => 'Type Pg',
			'type_p_vasn' => 'Type P Vasn',
			'type_g_pebg' => 'Type G Pebg',
			'open' => 'Open',
			'c_email' => 'C Email',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('user_id',$this->user_id);
		$criteria->compare('nickname',$this->nickname,true);
		$criteria->compare('idcard',$this->idcard,true);
		$criteria->compare('sex',$this->sex);
		$criteria->compare('birthday',$this->birthday);
		$criteria->compare('place',$this->place,true);
		$criteria->compare('nation',$this->nation,true);
		$criteria->compare('marry',$this->marry);
		$criteria->compare('address',$this->address,true);
		$criteria->compare('contact',$this->contact,true);
		$criteria->compare('post',$this->post,true);
		$criteria->compare('phone',$this->phone,true);
		$criteria->compare('im',$this->im,true);
		$criteria->compare('politics',$this->politics);
		$criteria->compare('jobtitle',$this->jobtitle,true);
		$criteria->compare('job',$this->job,true);
		$criteria->compare('blog',$this->blog,true);
		$criteria->compare('pphoto',$this->pphoto,true);
		$criteria->compare('highest_education',$this->highest_education);
		$criteria->compare('graduation_date',$this->graduation_date,true);
		$criteria->compare('school',$this->school,true);
		$criteria->compare('department',$this->department,true);
		$criteria->compare('specialities',$this->specialities,true);
		$criteria->compare('research_directions',$this->research_directions,true);
		$criteria->compare('work_experience',$this->work_experience,true);
		$criteria->compare('scientific_result',$this->scientific_result,true);
		$criteria->compare('achievement',$this->achievement,true);
		$criteria->compare('social_position',$this->social_position,true);
		$criteria->compare('n_second_school_major',$this->n_second_school_major,true);
		$criteria->compare('n_computer_skill',$this->n_computer_skill,true);
		$criteria->compare('n_computer_achievement',$this->n_computer_achievement,true);
		$criteria->compare('n_skill_mark',$this->n_skill_mark,true);
		$criteria->compare('n_work',$this->n_work,true);
		$criteria->compare('n_activity',$this->n_activity);
		$criteria->compare('s_admission_date',$this->s_admission_date,true);
		$criteria->compare('s_studentid',$this->s_studentid,true);
		$criteria->compare('s_school_position',$this->s_school_position,true);
		$criteria->compare('c_legal_person',$this->c_legal_person,true);
		$criteria->compare('c_hr_manager',$this->c_hr_manager,true);
		$criteria->compare('c_contacter_tel',$this->c_contacter_tel,true);
		$criteria->compare('c_introduce_photo',$this->c_introduce_photo,true);
		$criteria->compare('c_id_photo',$this->c_id_photo,true);
		$criteria->compare('c_introduce',$this->c_introduce,true);
		$criteria->compare('c_board_members',$this->c_board_members,true);
		$criteria->compare('type_pg',$this->type_pg);
		$criteria->compare('type_p_vasn',$this->type_p_vasn);
		$criteria->compare('type_g_pebg',$this->type_g_pebg);
		$criteria->compare('open',$this->open);
		$criteria->compare('c_email',$this->c_email,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}